home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / desktop / att32all.zip / CHIMES.FRM < prev    next >
Text File  |  1994-11-16  |  13KB  |  451 lines

  1. VERSION 2.00
  2. Begin Form Chimes 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Chimes"
  6.    ClientHeight    =   5835
  7.    ClientLeft      =   3060
  8.    ClientTop       =   1050
  9.    ClientWidth     =   3660
  10.    ClipControls    =   0   'False
  11.    ControlBox      =   0   'False
  12.    Height          =   6270
  13.    Left            =   2985
  14.    LinkTopic       =   "Form2"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   5835
  18.    ScaleWidth      =   3660
  19.    Top             =   690
  20.    Width           =   3810
  21.    Begin PictureBox PlayIt 
  22.       AutoSize        =   -1  'True
  23.       BorderStyle     =   0  'None
  24.       Height          =   330
  25.       Left            =   510
  26.       Picture         =   CHIMES.FRX:0000
  27.       ScaleHeight     =   330
  28.       ScaleWidth      =   360
  29.       TabIndex        =   12
  30.       Top             =   4530
  31.       Width           =   360
  32.    End
  33.    Begin PictureBox SpeakerDown 
  34.       AutoSize        =   -1  'True
  35.       BorderStyle     =   0  'None
  36.       Height          =   330
  37.       Left            =   5880
  38.       Picture         =   CHIMES.FRX:0182
  39.       ScaleHeight     =   330
  40.       ScaleWidth      =   360
  41.       TabIndex        =   14
  42.       TabStop         =   0   'False
  43.       Top             =   1320
  44.       Width           =   360
  45.    End
  46.    Begin PictureBox SpeakerUp 
  47.       AutoSize        =   -1  'True
  48.       BorderStyle     =   0  'None
  49.       Height          =   330
  50.       Left            =   5880
  51.       Picture         =   CHIMES.FRX:0304
  52.       ScaleHeight     =   330
  53.       ScaleWidth      =   360
  54.       TabIndex        =   15
  55.       TabStop         =   0   'False
  56.       Top             =   840
  57.       Width           =   360
  58.    End
  59.    Begin CommonDialog CMDialog1 
  60.       DefaultExt      =   "wav"
  61.       Filter          =   "Sound files (*.wav)|*.wav"
  62.       Left            =   5880
  63.       Top             =   240
  64.    End
  65.    Begin CommandButton Command1 
  66.       Caption         =   "OK"
  67.       Default         =   -1  'True
  68.       Height          =   330
  69.       Index           =   0
  70.       Left            =   510
  71.       TabIndex        =   10
  72.       Top             =   5250
  73.       Width           =   1170
  74.    End
  75.    Begin CommandButton Command1 
  76.       Cancel          =   -1  'True
  77.       Caption         =   "Cancel"
  78.       Height          =   330
  79.       Index           =   1
  80.       Left            =   1950
  81.       TabIndex        =   11
  82.       Top             =   5250
  83.       Width           =   1170
  84.    End
  85.    Begin SSCheck Chime 
  86.       Caption         =   "Hourly"
  87.       ForeColor       =   &H00000000&
  88.       Height          =   315
  89.       Index           =   0
  90.       Left            =   495
  91.       TabIndex        =   0
  92.       Top             =   330
  93.       Width           =   825
  94.    End
  95.    Begin CommandButton Command2 
  96.       Caption         =   " &Sound..."
  97.       Enabled         =   0   'False
  98.       Height          =   360
  99.       Index           =   0
  100.       Left            =   1950
  101.       TabIndex        =   1
  102.       Top             =   300
  103.       Width           =   1170
  104.    End
  105.    Begin SSCheck Chime 
  106.       Caption         =   "Multi-Ding«"
  107.       ForeColor       =   &H00000000&
  108.       Height          =   315
  109.       Index           =   4
  110.       Left            =   495
  111.       TabIndex        =   2
  112.       Top             =   1170
  113.       Width           =   1305
  114.    End
  115.    Begin CommandButton Command2 
  116.       Caption         =   " &Sound..."
  117.       Enabled         =   0   'False
  118.       Height          =   360
  119.       Index           =   4
  120.       Left            =   1950
  121.       TabIndex        =   3
  122.       Top             =   1140
  123.       Width           =   1170
  124.    End
  125.    Begin SSCheck Chime 
  126.       Caption         =   "Quarter of"
  127.       ForeColor       =   &H00000000&
  128.       Height          =   315
  129.       Index           =   3
  130.       Left            =   495
  131.       TabIndex        =   8
  132.       Top             =   3690
  133.       Width           =   1230
  134.    End
  135.    Begin CommandButton Command2 
  136.       Caption         =   " &Sound..."
  137.       Enabled         =   0   'False
  138.       Height          =   360
  139.       Index           =   3
  140.       Left            =   1950
  141.       TabIndex        =   9
  142.       Top             =   3660
  143.       Width           =   1170
  144.    End
  145.    Begin SSCheck Chime 
  146.       Caption         =   "Half past"
  147.       ForeColor       =   &H00000000&
  148.       Height          =   315
  149.       Index           =   2
  150.       Left            =   495
  151.       TabIndex        =   6
  152.       Top             =   2850
  153.       Width           =   1215
  154.    End
  155.    Begin CommandButton Command2 
  156.       Caption         =   " &Sound..."
  157.       Enabled         =   0   'False
  158.       Height          =   360
  159.       Index           =   2
  160.       Left            =   1950
  161.       TabIndex        =   7
  162.       Top             =   2820
  163.       Width           =   1170
  164.    End
  165.    Begin SSCheck Chime 
  166.       Caption         =   "Quarter after"
  167.       ForeColor       =   &H00000000&
  168.       Height          =   315
  169.       Index           =   1
  170.       Left            =   495
  171.       TabIndex        =   4
  172.       Top             =   2010
  173.       Width           =   1395
  174.    End
  175.    Begin CommandButton Command2 
  176.       Caption         =   " &Sound..."
  177.       Enabled         =   0   'False
  178.       Height          =   360
  179.       Index           =   1
  180.       Left            =   1950
  181.       TabIndex        =   5
  182.       Top             =   1980
  183.       Width           =   1170
  184.    End
  185.    Begin Label CurrentSound 
  186.       AutoSize        =   -1  'True
  187.       BackStyle       =   0  'Transparent
  188.       Caption         =   "Label1"
  189.       FontBold        =   0   'False
  190.       FontItalic      =   0   'False
  191.       FontName        =   "MS Sans Serif"
  192.       FontSize        =   8.25
  193.       FontStrikethru  =   0   'False
  194.       FontUnderline   =   0   'False
  195.       ForeColor       =   &H00000000&
  196.       Height          =   195
  197.       Left            =   960
  198.       TabIndex        =   20
  199.       Top             =   4590
  200.       Width           =   2535
  201.       WordWrap        =   -1  'True
  202.    End
  203.    Begin Label Label1 
  204.       Alignment       =   1  'Right Justify
  205.       BackStyle       =   0  'Transparent
  206.       Caption         =   "L&&abel1"
  207.       FontBold        =   0   'False
  208.       FontItalic      =   0   'False
  209.       FontName        =   "MS Sans Serif"
  210.       FontSize        =   8.25
  211.       FontStrikethru  =   0   'False
  212.       FontUnderline   =   0   'False
  213.       ForeColor       =   &H00000000&
  214.       Height          =   450
  215.       Index           =   4
  216.       Left            =   75
  217.       TabIndex        =   16
  218.       Top             =   1515
  219.       Width           =   3030
  220.    End
  221.    Begin Label Label1 
  222.       Alignment       =   1  'Right Justify
  223.       BackStyle       =   0  'Transparent
  224.       Caption         =   "Label1"
  225.       FontBold        =   0   'False
  226.       FontItalic      =   0   'False
  227.       FontName        =   "MS Sans Serif"
  228.       FontSize        =   8.25
  229.       FontStrikethru  =   0   'False
  230.       FontUnderline   =   0   'False
  231.       ForeColor       =   &H00000000&
  232.       Height          =   450
  233.       Index           =   3
  234.       Left            =   75
  235.       TabIndex        =   17
  236.       Top             =   4035
  237.       Width           =   3030
  238.    End
  239.    Begin Label Label1 
  240.       Alignment       =   1  'Right Justify
  241.       BackStyle       =   0  'Transparent
  242.       Caption         =   "Label1"
  243.       FontBold        =   0   'False
  244.       FontItalic      =   0   'False
  245.       FontName        =   "MS Sans Serif"
  246.       FontSize        =   8.25
  247.       FontStrikethru  =   0   'False
  248.       FontUnderline   =   0   'False
  249.       ForeColor       =   &H00000000&
  250.       Height          =   450
  251.       Index           =   2
  252.       Left            =   75
  253.       TabIndex        =   18
  254.       Top             =   3195
  255.       Width           =   3030
  256.    End
  257.    Begin Label Label1 
  258.       Alignment       =   1  'Right Justify
  259.       BackStyle       =   0  'Transparent
  260.       Caption         =   "Label1"
  261.       FontBold        =   0   'False
  262.       FontItalic      =   0   'False
  263.       FontName        =   "MS Sans Serif"
  264.       FontSize        =   8.25
  265.       FontStrikethru  =   0   'False
  266.       FontUnderline   =   0   'False
  267.       ForeColor       =   &H00000000&
  268.       Height          =   450
  269.       Index           =   1
  270.       Left            =   75
  271.       TabIndex        =   19
  272.       Top             =   2355
  273.       Width           =   3030
  274.    End
  275.    Begin Label Label1 
  276.       Alignment       =   1  'Right Justify
  277.       BackStyle       =   0  'Transparent
  278.       Caption         =   "Label1"
  279.       FontBold        =   0   'False
  280.       FontItalic      =   0   'False
  281.       FontName        =   "MS Sans Serif"
  282.       FontSize        =   8.25
  283.       FontStrikethru  =   0   'False
  284.       FontUnderline   =   0   'False
  285.       ForeColor       =   &H00000000&
  286.       Height          =   450
  287.       Index           =   0
  288.       Left            =   75
  289.       TabIndex        =   13
  290.       Top             =   675
  291.       Width           =   3030
  292.    End
  293. End
  294. Option Explicit
  295. Dim Playing As Integer
  296.  
  297. Sub Chime_Click (Index As Integer, Value As Integer)
  298.    Command2(Index).Enabled = Value
  299.    If Value Then
  300.       Label1(Index).ForeColor = 0
  301.    Else
  302.       Label1(Index).ForeColor = RGB(128, 128, 128)
  303.    End If
  304. End Sub
  305.  
  306. Sub Chime_GotFocus (Index As Integer)
  307. CurrentSound.Caption = (Label1(Index).Caption)
  308. End Sub
  309.  
  310. Sub Command1_Click (Index As Integer)
  311. Dim I%
  312. If Index = 0 Then
  313.    For I% = 0 To 3
  314.       Quartering%(I%) = Chime(I%).Value
  315.       Call Chime_Click(I%, (Chime(I%).Value))
  316.       QuarterChimes$(I%) = DitchAmper$(Label1(I%).Caption)
  317.    Next I%
  318.    ChimingRelentlessly = Chime(4).Value
  319.    HourChimes$ = DitchAmper$(Label1(4).Caption)
  320. End If
  321. Unload Me
  322. End Sub
  323.  
  324. Sub Command2_Click (Index As Integer)
  325.    CMDialog1.CancelError = True
  326.    On Error Resume Next
  327.    Select Case Index
  328.       Case 0
  329.          CMDialog1.DialogTitle = "Choose Hourly Sound File"
  330.          CMDialog1.Filename = QuarterChimes$(Index)
  331.       Case 1
  332.          CMDialog1.DialogTitle = "Choose Quarter-after Sound File"
  333.          CMDialog1.Filename = QuarterChimes$(Index)
  334.       Case 2
  335.          CMDialog1.DialogTitle = "Choose Half-past Sound File"
  336.          CMDialog1.Filename = QuarterChimes$(Index)
  337.       Case 3
  338.          CMDialog1.DialogTitle = "Choose Quarter-of Sound File"
  339.          CMDialog1.Filename = QuarterChimes$(Index)
  340.       Case 4
  341.          CMDialog1.DialogTitle = "Choose Multi-Ding« Sound File"
  342.          CMDialog1.Filename = HourChimes$
  343.    End Select
  344.    CMDialog1.Flags = OFN_HIDEREADONLY
  345.    CMDialog1.Action = 1
  346.    If Err = 0 Then
  347.       Select Case Index
  348.          Case 0
  349.             QuarterChimes$(Index) = CMDialog1.Filename
  350.          Case 1
  351.             QuarterChimes$(Index) = CMDialog1.Filename
  352.          Case 2
  353.             QuarterChimes$(Index) = CMDialog1.Filename
  354.          Case 3
  355.             QuarterChimes$(Index) = CMDialog1.Filename
  356.          Case 4
  357.             HourChimes$ = CMDialog1.Filename
  358.        End Select
  359.       CurrentSound.Caption = ExpandAmper$(CMDialog1.Filename)
  360.       LoadLabels
  361.       gCMDialog1Filename = CMDialog1.Filename
  362.       Call Chime_Click(Index, True)
  363.    End If
  364.  
  365. End Sub
  366.  
  367. Sub Command2_GotFocus (Index As Integer)
  368. CurrentSound.Caption = (Label1(Index).Caption)
  369. End Sub
  370.  
  371. Sub Command3_Click (Index As Integer)
  372. If Index = 1 Then Unload Me
  373. End Sub
  374.  
  375. Function DitchAmper$ (ByVal A$)
  376. Dim I%
  377. For I% = 1 To Len(A$) - 1
  378. If Mid$(A$, I%, 2) = "&&" Then
  379.    A$ = Left$(A$, I%) + Mid$(A$, I% + 2, 30000)
  380.    I% = I% - 1
  381. End If
  382. Next I%
  383. DitchAmper$ = A$
  384. End Function
  385.  
  386. '
  387. Function ExpandAmper$ (ByVal A$)
  388. Dim I%
  389. For I% = 1 To Len(A$)
  390. If Mid$(A$, I%, 1) = "&" Then
  391.    A$ = Left$(A$, I%) + "&" + Mid$(A$, I% + 1, 30000)
  392.    I% = I% + 1
  393. End If
  394. Next I%
  395. ExpandAmper$ = A$
  396. End Function
  397.  
  398. Sub Form_Load ()
  399. Dim I%
  400.    Chimes.Left = Screen.Width / 2 - (Chimes.Width / 2)
  401.    Chimes.Top = Screen.Height / 2 - (Chimes.Height / 2)
  402.    For I% = 0 To 3
  403.       Chime(I%).Value = Quartering%(I%)
  404.       Call Chime_Click(I%, (Chime(I%).Value))
  405.    Next I%
  406.    Chime(4).Value = ChimingRelentlessly
  407.    Call Chime_Click(4, (Chime(4).Value))
  408.    LoadLabels
  409. End Sub
  410.  
  411. Sub Label1_Click (Index As Integer)
  412. CurrentSound.Caption = Label1(Index).Caption
  413. End Sub
  414.  
  415. Sub LoadLabels ()
  416. Label1(0).Caption = ExpandAmper(QuarterChimes$(0))
  417. Label1(1).Caption = ExpandAmper(QuarterChimes$(1))
  418. Label1(2).Caption = ExpandAmper(QuarterChimes$(2))
  419. Label1(3).Caption = ExpandAmper(QuarterChimes$(3))
  420. Label1(4).Caption = ExpandAmper(HourChimes$)
  421. End Sub
  422.  
  423. Sub PlayIt_Click ()
  424. Dim x%
  425. If Not ThereIsSOund Then Exit Sub
  426.  
  427. If SndPlaySound("", 1 + SND_NOSTOP) = 0 Then
  428.    x% = SndPlaySound("", 0)
  429.    Exit Sub
  430. End If
  431.  
  432. Playing = True
  433.     Do While SndPlaySound(DitchAmper$(CurrentSound.Caption), 1 + SND_NOSTOP) = 0
  434.        If SoundAborted Then
  435.           x% = SndPlaySound("", 0)
  436.           Exit Do
  437.        End If
  438.        'DoEvents
  439.     Loop
  440.     Playing = False
  441. End Sub
  442.  
  443. Sub PlayIt_MouseDown (Button As Integer, Shift As Integer, x As Single, Y As Single)
  444. PlayIt.Picture = SPeakerDown.Picture
  445. End Sub
  446.  
  447. Sub PlayIt_MouseUp (Button As Integer, Shift As Integer, x As Single, Y As Single)
  448. PlayIt.Picture = SPeakerUp.Picture
  449. End Sub
  450.  
  451.